package com.project.webapp.action.front.preSchool;

import java.util.List;

import com.project.dao.bean.Article;
import com.project.service.backend.basic.IPaperService;
import com.project.webapp.action.BaseAction;

/**
 * 课程发布 Action
 * @author Sn
 *
 */
public class ReleaseAction extends BaseAction 
{

	/**
	 * 序列化版本号
	 */
	private static final long serialVersionUID = 1L;
	private String operateResult = "";

	private IPaperService paperService;
	private Article article;
	List<Article> articleList;
	
	@Override
	public String execute() throws Exception 
	{
		article = new Article();
		if(articleList!=null && articleList.size()>0)
		{
			articleList.clear();
		}
		return this.query();
	}
	
	public String showAdd() 
	{
		article = new Article();
        operateResult = "";
        return SUCCESS;
    }

    /**
     * 
     * <pre>
     * 查询
     * </pre>
     *
     * @return
     */
    public String query() 
    {

        return SUCCESS;
    }
    
    /**
     * 
     * <pre>
     * 保存
     * </pre>
     *
     * @return
     */
    public String save() 
    {
    	try 
    	{
    		article.setArea(article.getArea_s()+article.getArea_e());
    		paperService.save(article);
    		operateResult = "suc";
    	} catch (Exception e) 
    	{
    		e.printStackTrace();
    		operateResult = "fail";
    	}
    	article = new Article();
    	return "suc";
    }
	
    public String getOperateResult() {
    	return operateResult;
    }
    
    public void setOperateResult(String operateResult) {
    	this.operateResult = operateResult;
    }
    
    public IPaperService getPaperService() {
    	return paperService;
    }
    
    public void setPaperService(IPaperService paperService) {
    	this.paperService = paperService;
    }
    
    public Article getArticle() {
    	return article;
    }
    
    public void setArticle(Article article) {
    	this.article = article;
    }
    
    public List<Article> getArticleList() {
    	return articleList;
    }
    
    public void setArticleList(List<Article> articleList) {
    	this.articleList = articleList;
    }
    
    public static long getSerialversionuid() {
    	return serialVersionUID;
    }

    
}
